<%@ page language="java" contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
	<head>
		<title>数据字典添加页面</title>
		<%@ include file="../../common/jsp/header.jsp"%>
		<link href="${path }/static/css/plugins/file-input/fileinput.min.css" rel="stylesheet">
        <link href="<%=path%>static/css/plugins/ztree/zTreeStyle/zTreeStyle.css" rel="stylesheet">
        <script type="text/javascript" src="<%=path%>/static/js/plugins/ztree/jquery.ztree.core-3.5.js"></script>
        
        <script language="JavaScript">

            function beforeClick(treeId, treeNode) {

            }

            function onClick(e, treeId, treeNode) {
                var zTree = $.fn.zTree.getZTreeObj("tree"),
                    nodes = zTree.getSelectedNodes(),
                    v = "";
                    id="";
                nodes.sort(function compare(a,b){return a.id-b.id;});
                for (var i=0, l=nodes.length; i<l; i++) {
                    v += nodes[i].name + ",";
                    id +=nodes[i].id + ",";
                }
                if (v.length > 0 ) v = v.substring(0, v.length-1);
                if (id.length > 0 ) id = id.substring(0, id.length-1);
                var cityObj = $("#citySel");
                cityObj.attr("value", v);
                var gamPid=$("#gamPid");
                gamPid.attr("value",id);
            }

            function showMenu() {
                var cityObj = $("#citySel");
                var cityOffset = $("#citySel").offset();
                $("#menuContent").css({left:cityOffset.left + "px", top:cityOffset.top + cityObj.outerHeight() + "px"}).slideDown("fast");

                $("body").bind("mousedown", onBodyDown);
            }
            function hideMenu() {
                $("#menuContent").fadeOut("fast");
                $("body").unbind("mousedown", onBodyDown);
            }
            function onBodyDown(event) {
                if (!(event.target.id == "menuBtn" || event.target.id == "menuContent" || $(event.target).parents("#menuContent").length>0)) {
                    hideMenu();
                }
            }

            $(function () {
                var setting = {
                    view: {
                        dblClickExpand: false
                    },
                    data: {
                        simpleData: {
                            enable: true
                        }
                    },
                    callback: {
                        beforeClick: beforeClick,
                        onClick: onClick
                    }
                };
                $.post(root+"type/queryAlltype.do",function (zNodes) {
                    $.fn.zTree.init($("#tree"), setting, zNodes);
                })
                   },"json");


        </script>
	</head>
	<body>
		<div class="wrapper wrapper-content animated fadeInRight">
			<div>
				<div class="col-sm-4"><input type="button" value="返回上一页" class="btn btn-success" onclick="javascript:history.back();"/></div>
			</div>
			<div class="ibox float-e-margins">
				<form action="${path}/type/create.do" method="post" class="form-horizontal" role="form">
                    <input type="hidden1" name="typePid" id="gamPid"/>
                    <fieldset>
                        <legend>物资基本信息</legend>
                        <div class="form-group">
                            <label class="col-sm-2 control-label" for="ds_host">分类父节点</label>
                            <div class="col-sm-2">
                                <div class="col-sm-10">
                               <input  class="form-control"  id="citySel" type="text"   readonly />
                                    <div id="menuContent" class="menuContent" style="display:none;">
                                        <ul id="tree" class="ztree" style="margin-top:0; width:160px;"></ul>
                                    </div>
                                </div>
                                <div class="col-sm-2">
                                    <a id="menuBtn" href="#" onclick="showMenu(); return false;">
                                        <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span></a>
                                </div>
                            </div>
                        </div>


                       <div class="form-group">
                          <label class="col-sm-2 control-label" for="ds_host">分类编号</label>
                          <div class="col-sm-2">
                             <input class="form-control" type="text" name="typeNumber" placeholder="分类编号"/>
                          </div>
                       </div>
                       <div class="form-group">
                          <label class="col-sm-2 control-label" for="ds_username">分类名称</label>
                          <div class="col-sm-2">
                             <input class="form-control" type="text"  name="typeName" placeholder="分类名称"/>
                          </div>
                       </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label" for="ds_username">分类简称</label>
                            <div class="col-sm-2">
                                <input class="form-control" type="text"  name="typeShortHand" placeholder="分类简称"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label" for="ds_username">展开节点</label>
                                <div class="col-sm-4">
                                    <input  type="radio"  name="typeState" value="0" />关闭
                                    <input type="radio"  name="typeState" value="1"/>展开
                                </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label" for="ds_username">节点顺序</label>
                            <div class="col-sm-2">
                                <input class="form-control" type="text"  name="typeOrder" placeholder="节点顺序"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label" for="ds_username">节点等级</label>
                            <div class="col-sm-2">
                                <input class="form-control" type="text"  name="typeLevel" placeholder="节点等级"/>
                            </div>
                        </div>
                    </fieldset>
                    <fieldset>
                        <div class="form-group">
                        	<label class="col-sm-2 control-label" for="ds_host"></label>
                           	<div class="col-sm-4">
                              	<input type="submit" value="提交" class="btn btn-primary"/>
                                <input type="reset" value="重置" class="btn btn-danger" id="resetForm"/>
                           	</div>
                        </div>
                    </fieldset>
                </form>
			</div>
		</div>
	</body>
	<script type="text/javascript" src="${path}/static/js/plugins/file-input/fileinput.min.js"></script>

</html>